package com.essence.common.task;

import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;

public abstract class OnceTask extends TaskExecutor {
    private long delaySecond;

    public OnceTask(String taskName, long second) {
        super(taskName, second * 1000);
        this.delaySecond = second * 1000;
    }

    public long getDelaySecond() {
        return delaySecond;
    }

    @Override
    public TaskType taskType() {
        return TaskType.ONCE;
    }

    @Override
    public void notifySuccess() {
        getTaskLauncher().removeTask(getTaskName());
    }

    @Override
    public List<LocalDateTime> computeFireTimesBetween(LocalDateTime from, LocalDateTime to) {
        return Collections.emptyList();
    }
}
